<?php
function connectToDB()
{ 
$con = mysql_connect("localhost","root","admin");
if(!$con)
{ 
header("location:index.php?message=".urlencode('Could not connect: ' . mysql_error())); 
die(); 
} 
mysql_select_db("apodb", $con); 
return $con; 
}
?>